package Engine.RMI
{
	import Framework.Serialize.*;
	
	public class ERMIMessageType extends Object
	{
		public var __value:int;
		private static const __T:Array = ["MessageTypeCall", "MessageTypeCallRet", "MessageTypeCallRedirect", "MessageTypeCallRetRedirect", "MessageTypeMQ"];
		private static var __values:Array = new Array();
		public static const _MessageTypeCall:int = 0;
		public static const MessageTypeCall:ERMIMessageType = new ERMIMessageType(_MessageTypeCall);
		public static const _MessageTypeCallRet:int = 1;
		public static const MessageTypeCallRet:ERMIMessageType = new ERMIMessageType(_MessageTypeCallRet);
		public static const _MessageTypeCallRedirect:int = 2;
		public static const MessageTypeCallRedirect:ERMIMessageType = new ERMIMessageType(_MessageTypeCallRedirect);
		public static const _MessageTypeCallRetRedirect:int = 3;
		public static const MessageTypeCallRetRedirect:ERMIMessageType = new ERMIMessageType(_MessageTypeCallRetRedirect);
		public static const _MessageTypeMQ:int = 4;
		public static const MessageTypeMQ:ERMIMessageType = new ERMIMessageType(_MessageTypeMQ);
		
		public function ERMIMessageType(value:int)
		{
			this.__value = value;
			__values[value] = this;
		}
		
		public function value() : int
		{
			return this.__value;
		}
		
		public function toString() : String
		{
			return __T[this.__value];
		}
		
		public function equals(model:Object) : Boolean
		{
			if (model == this)
			{
				return true;
			}

			if (model == null)
			{
				return false;
			}
			return this.__value == model.value();
		}
		
		public function hashCode() : int
		{
			return 5 * this.__value;
		}
		
		public function __write(stream:SerializeStream) : void
		{
			stream.writeByte(this.__value);
		}
		
		public static function convert(value:int) : ERMIMessageType
		{
			return __values[value];
		}
		
		public static function __read(stream:SerializeStream) : ERMIMessageType
		{
			var byte:* = stream.readByte();
			if (byte < 0 || byte >= 5)
			{
				throw new MarshalException();
			}
			return ERMIMessageType.convert(byte);
		}
	}
}
